fallback-c89: Try to make isnanf work
authorChristoph Reiter <reiter.christoph@gmail.com>
Sun, 31 May 2020 13:09:31 +0000 (15:09 +0200)
committerChristoph Reiter <reiter.christoph@gmail.com>
Sun, 31 May 2020 13:50:09 +0000 (15:50 +0200)
gtk/fallback-c89.c

index 505d52e13a84e9136e0559cdfb8bb17d36874b46..65cb53589e0174de84ebe8eaefde10cef4886fcc 100644 (file)
@@ -20,6 +20,7 @@
 #include "config.h"
 
 #include <math.h>
+#include <float.h>
 
 /* Workaround for round() for non-GCC/non-C99 compilers */
 #ifndef HAVE_ROUND
@@ -93,26 +94,21 @@ isnan (double x)
 #endif
 
 #ifndef HAVE_DECL_ISNANF
-#if 1
-#define isnanf(x) isnan(x)
-#else
-/* it seems of the supported compilers only
- * MSVC does not have isnanf(), but it does
- * have _isnanf() which does the same as isnanf()
- */
-#ifdef _MSC_VER
-static inline gboolean
-isnanf (float x)
-{
-  return _isnanf (x);
-}
-#elif defined (__GNUC__)
+#if defined (__GNUC__)
 /* gcc has an intern function that it warns about when
  * using -Wshadow but no header properly declares it,
  * so we do it instead.
  */
 extern int isnanf (float x);
-#endif
+#else
+static inline int
+isnanf (float x)
+{
+  /* Either use the C99 type infering macro, or the fallback from above.
+   * MSVC has _isnanf, but only on x64
+   */
+  return isnan (x);
+}
 #endif
 #endif